package intention;

import java.awt.image.BufferedImage;
import javax.swing.*;
import java.awt.Graphics;
import java.awt.Image;



public class ImagePanel extends JPanel {
    private BufferedImage image;
    private Graphics myG;
    public ImagePanel(BufferedImage image) {
        this.image = image;
    }
    @Override
    protected void paintComponent(Graphics g) {
        int h = this.getHeight();
        int w = this.getWidth();
        Image temp = image.getScaledInstance(w, h, BufferedImage.SCALE_SMOOTH);
        g.drawImage(temp, 0, 0, null);
    }
    public void updateImage(BufferedImage image)
    {
        this.image = image;
        this.repaint();
    }
}